//
//  ESCoverView.m
//  Eyeshot
//
//  Created by lanou3g on 15/7/6.
//  Copyright (c) 2015年 eyeshot. All rights reserved.
//

#import "ESCoverView.h"
#import "ESVideoTableViewCell.h"
@interface ESCoverView ()

@property (nonatomic, strong) UIButton *replay;
@end

@implementation ESCoverView
- (ESCoverView *)coverWithFrame:(CGRect)frame SuperView:(UIView *)view
{
//    ESCoverView *cover = [[ESCoverView alloc] initWithFrame:frame];
    self.frame = frame;
    self.backgroundColor = [UIColor blackColor];
    self.alpha = 0.5;
    
    UIButton *replay = [UIButton buttonWithType:UIButtonTypeCustom];
    [replay setImage:[UIImage imageNamed:@"repeat_video"] forState:(UIControlStateNormal)];
    [replay addTarget:self action:@selector(replay:) forControlEvents:(UIControlEventTouchUpInside)];
    CGSize size = replay.currentImage.size;
    replay.frame = CGRectMake(2*kPading, view.height/2 - size.height/2,size.width, size.height);
    [self addSubview:replay];
 
    UIButton *shareBtn = [[UIButton alloc] init];
    [shareBtn setImage:[UIImage imageNamed:@"share_video"] forState:(UIControlStateNormal)];
    [shareBtn addTarget:self action:@selector(share:) forControlEvents:(UIControlEventTouchUpInside)];
    CGSize sizeShare = shareBtn.currentImage.size;
    shareBtn.frame = CGRectMake(view.width - 2*kPading - sizeShare.width, view.height/2 - sizeShare.height/2, sizeShare.width, sizeShare.height);
    [self addSubview:shareBtn];
    [view addSubview:self];
    return self;
}


-(void)replay:(UIButton *)btn
{
    if (self.delegate != nil && [self.delegate respondsToSelector:@selector(ESCoverView:didSelectReplayBtn:)]) {
        [self.delegate ESCoverView:self didSelectReplayBtn:btn];
    }
    ESLog(@"adad");
}
-(void)share:(UIButton *)btn
{
     ESLog(@"ddddd");
}
@end
